{extend name="layout/main" /}

{block name="header"}

{/block}

{block name="content"}
<section class="panel">
    <header class="panel-heading">
        <h4>公告列表</h4>
    </header>
    <div class="panel-body" style="padding-bottom: 50px">
        <form class="form-horizontal" action="{:url('admin/notice/index')}">
            <div class="form-group">
                <div class="col-xs-1 no-pd-r">
                    <select name="type" class="form-control">
                        <option {if $Request.get.type == 'title'} selected {/if} value="title">标题</option>
                        <option {if $Request.get.type == 'content'} selected {/if} value="content">内容</option>
                    </select>
                </div>
                <div class="col-xs-3 no-pd-l">
                    <input type="text" value="{$Request.get.keywords}" name="keywords" class="form-control" placeholder="请输入关键词搜索">
                </div>
                <button type="submit" class="btn btn-color">搜索</button>
                <a type="button" href="/admin/notice/create" class="btn btn-info">添加公告</a>
            </div>
        </form>
        <table class="table table-bordered table-striped no-margin">
            <thead>
            <tr>
                <th class="text-center">标题</th>
                <th class="text-center">内容</th>
                <th class="text-center">状态</th>
                <th class="text-center">操作</th>
            </tr>
            </thead>
            <tbody>
            {if !empty($list)}
                {foreach $list as $v}
                <tr>
                    <td style="vertical-align: middle" class="text-center">
                        {$v->title}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {$v->content}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {if $v->status == 0}
                        <a class="btn btn-xs btn-danger">禁用</a>
                        {else /}
                        <a class="btn btn-xs btn-success">正常</a>
                        {/if}
                    </td>
                    <td style="vertical-align: middle;" class="text-center">
                        <a href="{:url('notice/edit',['id'=>$v->id])}" class="btn btn-xs btn-info">编辑</a>
                        <a data-url="{:url('notice/delete',['id'=>$v->id])}" onclick="main.ajaxDelete(this)" data-msg="确定要删除吗？" class="btn btn-xs btn-danger">删除</a>
                        <br>
                        
                    </td>
                </tr>
                {/foreach}
            {else /}
            <tr class="text-center">
                <td colspan="9">暂无数据</td>
            </tr>
            {/if}
            </tbody>
        </table>
        <div class="page">
            {:htmlspecialchars_decode($list->render())}
        </div>
    </div>
</section>
{/block}

{block name="footer"}
<script>

</script>

{/block}